/**
 * Definition for a binary tree node.
 * function TreeNode(val) {
 *     this.val = val;
 *     this.left = this.right = null;
 * }
 */
/**
 * @param {TreeNode} root
 * @param {number} k
 * @return {number}
 */
 var kthLargest = function(root, k) {
    let n=1;
    let res;
    function digui (root){
        if(!root || n>k){
            return ;
        }
        digui(root.right);
        if(n==k){
            res=root.val;
        }
        n++;
        digui(root.left);
    }
    digui(root);
    return res;
};